'use strict';
const {
  unicodeLength,
  regular,
  unicodeCharAt,
  unicodeCodePointAt,
} = require('../src/main.js');

var assert = require('assert');
require('mocha-sinon');

describe('Better Unicode Support', function () {
  afterEach(function () {});
  beforeEach(function () {
    this.sinon.stub(console, 'log');
  });

  it('should 𠮷', function (done) {
    let text = '𠮷';
    assert.strictEqual(unicodeLength(text), 1);
    assert.strictEqual(regular(/^.$/, text), true);
    assert.strictEqual(unicodeCodePointAt(text, 0), 134071);
    assert.strictEqual(unicodeCodePointAt(text, 1), 57271);
    done();
  });

  it('should Template Literals', function (done) {
    let name = 'Nicholas',
      message = `Hello, ${name}.`;
      console.log(message);
      assert.strictEqual(console.log.calledWith('Hello, Nicholas.'), true);
    done();
  });
});
